 <? include("/inc/header.html") {} ?>
 
 <div class="col-lg-5">
   	<div class="panel" overflow: auto;">
          <div class="panel-body pan "style="width:auto; overflow: auto;" >
			<div class="form-body pal" style="float:left;width:100%; overflow: auto;"  >
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">词名称
						<span class='require' id="zhongwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon" >
							<input id="wordName" type="text" class="form-control" />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">链接地址
						<span class='require' id="yingwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="linkUrl" type="text"  class="form-control"  />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">字体颜色
						<span class='require' id="yingwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="fontColor" type="text"  class="form-control"  />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">字体大小
						<span class='require' id="yingwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="fontSize" type="text"  class="form-control"  />
						</div>
					</div>
				</div>
				<div>
					<label for="inputUsername" class="col-md-3 control-label">
					  <div align="right">排序
						<span class='require' id="yingwenName">*</span></div>
                    </label>
					<div class="col-md-7">
						<div class="input-icon">
							<input id="sort" type="text"  class="form-control"  />
						</div>
					</div>
				</div>
					
			</div>
		</form>
	</div>
  </div>
</div>
<script type="text/javascript">
	var id = window.parent.gethotwordsId();
	var curr = window.parent.getcurr();
	if(id !=0){
		$.ajax({
			type : "post",
			url : "queryhotwordsUplaod.do",
			dataType : "json",
			data:{
				"id":id
			},
			beforeSend : function(XMLHttpRequest) {},
			success: function(data) {
           		 //alert(JSON.stringify(data));
           		 $("#wordName").val(data[0].wordName);
           		 $("#linkUrl").val(data[0].linkUrl);
           		 $("#fontColor").val(data[0].fontColor);
           		 $("#fontSize").val(data[0].fontSize);
           		 $("#sort").val(data[0].sort);
    		}
		});
	}
	function save(){  
		$.ajax({
			type : "post",
			url : "hotwordsAddUpload.do",
			dataType : "json",
			data:{
				"wordName":$("#wordName").val(),
				"linkUrl":$("#linkUrl").val(),
				"fontColor":$("#fontColor").val(),
				"fontSize":$("#fontSize").val(),
				"sort":$("#sort").val(),
				"id":id,
			},
			beforeSend : function(XMLHttpRequest) {},
			success: function(data) {
           		 var index = parent.layer.getFrameIndex(window.name); 
           		 window.parent.hotwordsList(curr);
           		if(data == 'yes'){
	           		if(id ==0){
	           			parent.layer.msg('添加成功！');
	           		}else{
	           			parent.layer.msg('修改成功！');
	           		}
           		}else{
           			parent.layer.msg('添加失败！');
           		}
            	 parent.layer.close(index); 
    		}
		});
    } 
</script>
